home *** CD-ROM | disk | FTP | other *** search
- /*
-
- GHEL v1.2 [etc.]
-
- Programmed by Keijiro Takahashi (novice)
-
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <winb.h>
- #include <te.h>
- #include <fntb.h>
- #include <gui.h>
- #include <egb.h>
- #include <wgb.h>
- #include <guidbg.h>
- #include "type.h"
- #include "parts.h"
-
- extern char *guiEgbPtr;
-
-
-
-
- /*
-
- データロード
-
- */
- int loadhel(char *pathname,hel *helbuf)
- {
- FILE *fp;
- size_t size;
- int ret;
-
- if( (fp=fopen(pathname,"rb")) == NULL )
- {
- alert("ファイルのオープンに失敗しました");
- return(1);
- }
-
- fseek(fp,0,SEEK_END);
- size = (size_t)ftell(fp)-0xc;
- helbuf->page_max = size/2400-1;
-
- TL_free(helbuf->buf);
-
- if ( (helbuf->buf=TL_malloc(size)) == NULL )
- {
- alert("バッファの確保に失敗しました");
- fclose(fp);
- return(1);
- }
-
- fseek(fp,0xc,SEEK_SET);
-
- MG_SetPtr(MB_WAIT);
- ret=fread(helbuf->buf,1,size,fp);
- MG_SetPtr(MB_SELECT);
-
- fclose(fp);
-
- if(ret!=size)
- {
- alert("データのロードに失敗しました");
- TL_free(helbuf->buf);
- fclose(fp);
- return(1);
- }
-
- helbuf->page=0;
- return(0);
- }
-
-
-
-
-
- /*
-
- へらへら → 2bit/pixel
-
- */
- void helcnv(hel *buf)
- {
- int page,offset;
-
- MG_SetPtr(MB_WAIT);
-
- for(page=0 ; page<buf->page_max ; page++)
- {
- for(offset=0 ; offset<2400 ; offset++)
- {
- buf->buf[(page+1)*2400+offset] ^= buf->buf[page*2400+offset];
- }
- }
-
- MG_SetPtr(MB_SELECT);
-
- return;
- }
-